﻿package cn.ssm.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016091700531248";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCXpcrj843Zx/B2ATWQSmCLTPN5RPSidqukNAqgDxEfdB39/3hzt3eI44CrermWiqSG9Tfqibo5ehcy6BmLomYq2Z6apmiAJKm3fEDBI+ZtCvXUggIfCHxUIEB4mjis8YZMo71xuia8/Nw8t/h/BUfLKDSuB0F1tO0dCyOdJV8aGoTvfVp+lhe4bFitU6kt4WEcgWOOgVTyCENQpB/q2iDEiMJob78Q3COHrpRYoJ+v7kbm5sLoLQ2g7caG+i2hRAt5ozXx8FvND7gW9t/osWejTyaieKX9pM5XvLVK/LfNrjtzVfryonYZ37EEE4icy/aB4sa+0AGW7kWtUhoFVkeNAgMBAAECggEARxhmP2pe1XwkIt68QvJrwsMH3pHScxxZqfjwBkwqBeoFaaBM00tvUhD+sOYvfgFv0wnB9kYttWak26vu1gUECxDNh8l+cp09qBUrsqDnFbYuvDtbTTtINpSMRT5gVcxB30pgtaHFKZMOmbTSXpKWLwuhbvld2hZBl/0x7CmqJW0Sf4IZ9GEUspDsuQNo0++VUmTYU2f1kXBE+u50XATiMNAyqenz3lgWgZfjfXI54gs8zDQES/frYfhQFPg3J1pkmXIMyQq0RW9FqXggmgqxB7L92cM8qRJTeShD4rpVIrvnTFPi8CCGkB4VR9+7IMG7WJDGTUKDyCwKGJCXL6PQzQKBgQDNYxqmzH0KMfrML7bOXVlsruB182JAl9aDZda/RPwOCBcrCJRgxReCDrsiTmuh764v2AScFZ+7Y6OAon2oFTQoK6REHwaNNgyCCtO4hBbrhm+6XqUIRgwESO2i0VVfGpTPMpJ3Rc33/N4QgPmorNE4DfKVugIJ+tMYLp+SVZK77wKBgQC9BITzaiakQwyhJWrqCMKZ99iuA6KmZFPOq+RnmeaWM1ibqhs591DGnnu0t8f27MI+xeN0ooqYAQTmif2GTxWHcAjw6jjbsedU3prVdHTul0Txh1TiGFsvupur/fBNauThktlM3gSnbz70kuPbyLZHfIcLBC5ib8o0kFBU18poQwKBgQDG/NiKeB5BLXEmOKgtQeXs1XVk8ZvkpvdPMPChOW3XDmGb8OEI7Is9F5aYw0+mgffKJMk6i/zI6d00OLnzii+RJ88rrL+FOrNdnq3H3Dn0kLhY4W+VF4B2+k057QSActlv8ThUVI4cUKK5bKv1jxHY9DJue9uT3a59hFZXyY6zgwKBgQCkiAWOuOzv+SlKMH7zPzLdwV9Mgf+X5ScKdJf6En4kaoeL4LOYbo5ShevasEsQxqCC8dB/W2lWzTRN1PnpanesEDrIMqnRmvdp6edPPPL4KJarw4iA0oC1eDM/sGj3ir+3FxOuFGhqsqxTSnWrf/gjG+OVFEuoBfU2chRq9ffLbwKBgQCRzOaJVMjGKZKpevvrns1j0z0nbOZAolQGRTs6PzSifu4otCC7eqlBpubLaRATn3wPFB3CW9Q+v0O5VzBf9Tkl48Kq+cRfPr3Mfdi//VCIoNpQRAoyAJh3HqFycCvFXUe/r/j0h+R5JgydPBKDpIAowyYDs1sq1l4EUxjEFZSDcw==";
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
  
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIPtQX+leEOnponA90O4ARmPfJb5a4xJPjROoT71SM6af5g5dWrox4hFfdeZSRbYULrzFEkAXfYgcQeGbRWsGKPa2UXlN/oF5fHt/APhNlKorVdy1HrwYXbQJ5be4Px6C8J28QdbtntPb7B6jXLdeFYuqbUz1/CT7FIiC+/uM6SWpzVGpCjkDs+OQDjUxLnJbfSDgQD/Mxq54HE6JmRWrodk/gWJfnl43mZ/yNbGvTqbXNv/z8XD2mBXD5Akiv954aOhlVibfjczCK18iFcpnVohbADBnDV/fP4KXvkA1UNw2ynDFGMFurh4usgjVO3HcmR2ImC+5/79v02sI75U/QIDAQAB";
    		
	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/moviesMaven/alipay/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/moviesMaven/alipay/updateOrder.htm";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

